const mongoose = require('mongoose')
// 创建一个结构实例
const Schema = mongoose.Schema

// 创建一个结构
const UserSchema = new Schema({
  name: {
    type: String,
    required: true
  },
  email: {
    type: String,
    required: true
  },
  date: {
    type: Date,
    reuqired: false,
    default: Date.now
  },
  avatar: {
    type: String
  },
  password: {
    type: String,
    required: true
  },
  // checkPassword: {
  //   type: String,
  //   required: true
  // },
  identity: {
    type: String,
    reuqired: true
  }
})

const User = mongoose.model('users', UserSchema)

module.exports = User